//缓存存储方法类
class MyCache {
  saveItem(key, value) {
    localStorage.setItem(key, JSON.stringify(value));
  }

  getItem(key) {
    return JSON.parse(localStorage.getItem(key));
  }
  deleteItem(key) {
    localStorage.removeItem(key);
  }
  clear() {
    localStorage.clear();
  }
  saveItemS(key, value) {
    sessionStorage.setItem(key, JSON.stringify(value));
  }

  getItemS(key) {
    return JSON.parse(sessionStorage.getItem(key));
  }
  deleteItemS(key) {
    sessionStorage.removeItem(key);
  }
}

export default new MyCache();
